////
////#include <iostream>
////#include <stdio.h>
////#include <curl/curl.h>
////#include <curl/types.h>
////#include <curl/easy.h>
////
////#include "DownloadBeta.h"
////
////using namespace std; //temporario
////
////
////string DownloadBeta::getHeader(){
////	if(curl) curl_easy_setopt(curl, CURLOPT_URL, site_url.c_str());
////	curl_config();
////	return header_site;
////}
////
////string DownloadBeta::getRobot(){
////	string site_robot = site_url + "robots.txt";
////	if(curl) curl_easy_setopt(curl, CURLOPT_URL, site_robot.c_str());
////	curl_config();
//////	cout << "CODE:  " << res_code << endl << endl;
////	// Tratamento de erro simplista
////	if(res_code == 200) return data_site;
////	else                return "";
////}
////
////string DownloadBeta::getPage(){
////	if(curl) curl_easy_setopt(curl, CURLOPT_URL, site_url.c_str());
////	curl_config();
//////	cout << "CODE:  " << res_code << endl << endl;
////	// Tratamento de erro simplista
////	if(res_code == 200) return data_site;
////	else                return "";
////}
////
////size_t DownloadBeta::WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *userp){
////  size_t realsize = size * nmemb;
////  char *teste = (char *) ptr;
////  string *data_str = (string *) userp;
////  for(uint i=0; i < nmemb; i++) *data_str += teste[i];
////  return realsize;
////}
////
////size_t DownloadBeta::headerCallback(void *ptr, size_t size, size_t nmemb, void *userp){
////  size_t realsize = size * nmemb;
////  char *teste = (char *) ptr;
////  string *data_str = (string *) userp;
////  for(uint i=0; i < nmemb; i++) *data_str += teste[i];
////  return realsize;
////}
////
////int curl_trace(CURL *handle, curl_infotype type, unsigned char *data, size_t size, void *userp){
//////  struct data *config = (struct data *)userp;
//////  (void) handle; /* prevent compiler warning */
////  const char *text;	
////  switch (type) {
////  case CURLINFO_TEXT:
////	  cout << "- Info: "<< data << endl;
////  default: /* in case a new one is introduced to shock us */
////	  return 0;
////  case CURLINFO_HEADER_OUT:
////    text = "=> Send header";
////    break;
////  case CURLINFO_DATA_OUT:
////    text = "=> Send data";
////    break;
////  case CURLINFO_SSL_DATA_OUT:
////    text = "=> Send SSL data";
////    break;
////  case CURLINFO_HEADER_IN:
////    text = "<= Recv header";
////    break;
////  case CURLINFO_DATA_IN:
////    text = "<= Recv data";
////    break;
////  case CURLINFO_SSL_DATA_IN:
////    text = "<= Recv SSL data";
////    break;
////  }
////  cout << "All Data: "<< data << endl;
////  cout << text << endl;
//////  dump(text, stderr, data, size, config->trace_ascii);
////  return 0;
////}
////
////
////int progress_callback(void *userp, double dltotal, double dlnow, double ultotal, double ulnow){
////	cout << "dltotal: " << dltotal << endl; //download total
////	cout << "dlnow: " << dltotal << endl;   //download now
////	cout << "ultotal: " << dltotal << endl; //upload total
////	cout << "ulnow: " << dltotal << endl;   //upload now
////	return 0;
////}
////
//int DownloadBeta::curl_config(void) {
//  CURLcode res;
//  struct data config;
//  config.trace_ascii = 1; /* enable ascii tracing */
//  cleanBuffer();
//  
//  if(curl) {
//	curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_trace);
//	curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config);	       // dado generico do usuario
////    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
//    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
//    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data_site);
//    curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, headerCallback );
//    curl_easy_setopt(curl, CURLOPT_HEADERDATA,&header_site);
//    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0); // nao seguir Location Header
//    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);
////    curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
////    curl_easy_setopt(curl, CURLOPT_HEADER, 1);
////    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
////    curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
//    
////    http://www.pudim.com.br/robots.txt
////   --> MC: entre 5 e 6 milhao
////   --> Baggio: entre 1 e 2 milhao
////    http://www.ogrilofeliz.com.br/robots.txt
//    res = curl_easy_perform(curl);
//    res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &res_code);    
////    cout << curl_easy_strerror(res);  // imprime erro bonitinho em char*
//  }
//	return 0;
//}
////
////
//////
//////CURLOPT_RANGE 
//////
//////Pass a char * as parameter, which should contain the specified range you want. It should be in the format "X-Y", where X or Y may be left out. HTTP transfers also support several intervals, separated with commas as in "X-Y,N-M". Using this kind of multiple intervals will cause the HTTP server to send the response document in pieces (using standard MIME separation techniques). Pass a NULL to this option to disable the use of ranges. 
//////
//////Ranges work on HTTP, FTP and FILE (since 7.18.0) transfers only.
////
//////CURLOPT_TIMEOUT 
//////
//////Pass a long as parameter containing the maximum time in seconds that you allow the libcurl transfer operation to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations. This option will cause curl to use the SIGALRM to enable time-outing system calls. 
//////
//////In unix-like systems, this might cause signals to be used unless CURLOPT_NOSIGNAL is set. 
//////
//////CURLOPT_TIMEOUT_MS 
//////
//////Like CURLOPT_TIMEOUT but takes number of milliseconds instead. If libcurl is built to use the standard system name resolver, that part will still use full-second resolution for timeouts. (Added in 7.16.2)
////
